<template>
  <div class="box">
    <h3>😴这是一个递归组件{{ num }}</h3>
    <DiguiComponet
      v-if="num > 0"
      :num="num - 1"
    />
  </div>
</template>

<script>
export default {
  // 递归组件必须起个名字
  name: "DiguiComponet",
  props: ["num"],
};
</script>

<style lang="less" scoped>
.box {
  border: 1px solid hotpink;
  padding: 3px;
  margin: 3px;
  background-color: #fcfcfc;
}
</style>